home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
DEMO_VGA
/
FRSTM1.LZH
/
XBITASM.ASM
< prev
Wrap
Assembly Source File
|
1989-03-06
|
2KB
|
112 lines
; Xbitasm.asm by Mark C. Peterson, CompuServe [70441,3353]
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
;int near _cdecl XBitShift(XBIT x, int XBytes, int ShiftBits)
x equ [bp + 6]
XBytes equ [bp + 8]
ShiftBits equ [bp + 10]
PUBLIC _XBitShift
_XBitShift PROC FAR
push bp
mov bp, sp
push si
xor ax, ax
mov bx, ShiftBits
or bx, bx
jz ExitXBitShift
jns ShiftXBitsLeft
neg bx
ShiftXBitsRight:
mov si, x
mov cx, XBytes
add si, cx
clc
ShiftNextByteRight:
dec si
rcr BYTE PTR [si], 1
loop ShiftNextByteRight
dec bx
jnz ShiftXBitsRight
jmp ExitXBitShift
ShiftXBitsLeft:
mov si, x
mov cx, XBytes
clc
ShiftNextByteLeft:
rcl BYTE PTR [si], 1
inc si
loop ShiftNextByteLeft
adc ax, 0
dec bx
jnz ShiftXBitsLeft
ExitXBitShift:
pop si
pop bp
ret
_XBitShift ENDP
;void near _cdecl XBitNegate(XBIT x, int XBytes);
x equ [bp + 6]
XBytes equ [bp + 8]
PUBLIC _XBitNegate
_XBitNegate PROC FAR
push bp
mov bp, sp
push si
xor ax, ax
mov si, x
mov cx, XBytes
dec cx
add si, cx
cmp WORD PTR [si], 8000h
jne Negate
ChkNextWord:
dec si
dec si
cmp WORD PTR [si], 0
jne Negate
loop ChkNextWord
add si, XBytes
dec si
mov BYTE PTR [si], 0
inc ax
jmp ExitXBitNegate
Negate:
mov si, x
mov cx, XBytes
clc
NegateNextByte:
not WORD PTR [si]
adc WORD PTR [si], ax
inc si
inc si
dec cx
loop NegateNextByte
ExitXBitNegate:
pop si
pop bp
ret
_XBitNegate ENDP
_TEXT ENDS
END